TypeIdPair.cpp
Language: C++
Last Modified: 2021-10-23 9:47:57 PM UTC
File Size: 1111 bytes
Last Modified: 2021-10-23 9:47:57 PM UTC
File Size: 1111 bytes
http://www.penguinstew.ca/example/CodeFormater/TypeIdPair.cpp
includeTypeIdPairh
include<sstream>
defineTYPEPAIR_TYPE_ATTRIBUTEtype
defineTYPEPAIR_ID_ATTRIBUTEid
TypeIdPair::TypeIdPairstd::stringtypeintid
{
this>type=type;
this>id=id;
}
TypeIdPair::TypeIdPairxmlNodePtrxmlNode
{
type=;
id=1;
xmlCharxmlString;
xmlString=xmlGetPropxmlNodexmlCharStrdupTYPEPAIR_TYPE_ATTRIBUTE;
ifxmlString=NULL
{
type=std::stringcharxmlString;
}
xmlString=xmlGetPropxmlNodexmlCharStrdupTYPEPAIR_ID_ATTRIBUTE;
ifxmlString=NULL
{
ifxmlStrEqualxmlStringxmlCharStrdup==1
{
id=1;
}
else
{
id=atoicharxmlString;
}
}
}
boolTypeIdPair::IsMatchTypeIdPairtestType
{
returntypecomparetestTypetype==0id==1||id==testTypeid;
}
std::stringTypeIdPair::ToString
{
std::stringstreamstream;
stream<<TypeIDpair:;
stream<<Type:<<this>type<<;
ifid<0
{
stream<<Id:Any;
}
else
{
stream<<Id:<<this>id;
}
returnstreamstr;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62